package com.xyzq.model.ya.data;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.appfuse.model.BaseObject;

@Entity
@Table(name = "staff_sell_fund")
public class StaffSellFund extends BaseObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8569357272846049824L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "FK_STAFF_STAFF", nullable = false)
	private Staff staff;
	@Column(name = "fund_id")
	private String fundId;
	private String fund;
	@Column(scale = 2)
	private Double money;
	@Column(scale = 2)
	private Double deduct;
	@Column(scale = 2)
	private Double subscribe;
	@Column(scale = 2)
	private Double purchase;
	@Column(name = "timing_purchase", scale = 2)
	private Double timingPurchase;
	private Integer person;
	private String month;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "sub_time")
	private Date subTime;

	public void setStaffId(Integer staffId) {
		if (staff == null) {
			staff = new Staff();
		}
		this.staff.setStaffId(staffId);
	}

	public Long getId() {
		return id;
	}

	public Staff getStaff() {
		return staff;
	}

	public String getFundId() {
		return fundId;
	}

	public String getFund() {
		return fund;
	}

	public Double getMoney() {
		return money;
	}

	public Double getDeduct() {
		return deduct;
	}

	public Double getSubscribe() {
		return subscribe;
	}

	public Double getPurchase() {
		return purchase;
	}

	public Double getTimingPurchase() {
		return timingPurchase;
	}

	public Integer getPerson() {
		return person;
	}

	public String getMonth() {
		return month;
	}

	public Date getSubTime() {
		return subTime;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setStaff(Staff staff) {
		this.staff = staff;
	}

	public void setFundId(String fundId) {
		this.fundId = fundId;
	}

	public void setFund(String fund) {
		this.fund = fund;
	}

	public void setMoney(Double money) {
		this.money = money;
	}

	public void setDeduct(Double deduct) {
		this.deduct = deduct;
	}

	public void setSubscribe(Double subscribe) {
		this.subscribe = subscribe;
	}

	public void setPurchase(Double purchase) {
		this.purchase = purchase;
	}

	public void setTimingPurchase(Double timingPurchase) {
		this.timingPurchase = timingPurchase;
	}

	public void setPerson(Integer person) {
		this.person = person;
	}

	public void setMonth(String month) {
		this.month = month;
	}

	public void setSubTime(Date subTime) {
		this.subTime = subTime;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((deduct == null) ? 0 : deduct.hashCode());
		result = prime * result + ((fund == null) ? 0 : fund.hashCode());
		result = prime * result + ((fundId == null) ? 0 : fundId.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((money == null) ? 0 : money.hashCode());
		result = prime * result + ((month == null) ? 0 : month.hashCode());
		result = prime * result + ((person == null) ? 0 : person.hashCode());
		result = prime * result
				+ ((purchase == null) ? 0 : purchase.hashCode());
		result = prime * result + ((staff == null) ? 0 : staff.hashCode());
		result = prime * result + ((subTime == null) ? 0 : subTime.hashCode());
		result = prime * result
				+ ((subscribe == null) ? 0 : subscribe.hashCode());
		result = prime * result
				+ ((timingPurchase == null) ? 0 : timingPurchase.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		StaffSellFund other = (StaffSellFund) obj;
		if (deduct == null) {
			if (other.deduct != null)
				return false;
		} else if (!deduct.equals(other.deduct))
			return false;
		if (fund == null) {
			if (other.fund != null)
				return false;
		} else if (!fund.equals(other.fund))
			return false;
		if (fundId == null) {
			if (other.fundId != null)
				return false;
		} else if (!fundId.equals(other.fundId))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (money == null) {
			if (other.money != null)
				return false;
		} else if (!money.equals(other.money))
			return false;
		if (month == null) {
			if (other.month != null)
				return false;
		} else if (!month.equals(other.month))
			return false;
		if (person == null) {
			if (other.person != null)
				return false;
		} else if (!person.equals(other.person))
			return false;
		if (purchase == null) {
			if (other.purchase != null)
				return false;
		} else if (!purchase.equals(other.purchase))
			return false;
		if (staff == null) {
			if (other.staff != null)
				return false;
		} else if (!staff.equals(other.staff))
			return false;
		if (subTime == null) {
			if (other.subTime != null)
				return false;
		} else if (!subTime.equals(other.subTime))
			return false;
		if (subscribe == null) {
			if (other.subscribe != null)
				return false;
		} else if (!subscribe.equals(other.subscribe))
			return false;
		if (timingPurchase == null) {
			if (other.timingPurchase != null)
				return false;
		} else if (!timingPurchase.equals(other.timingPurchase))
			return false;
		return true;
	}

	@Override
	public String toString() {
		ToStringBuilder builder = new ToStringBuilder(this);
		builder.append("id", id);
		builder.append("staff", staff);
		builder.append("fundId", fundId);
		builder.append("fund", fund);
		builder.append("money", money);
		builder.append("deduct", deduct);
		builder.append("subscribe", subscribe);
		builder.append("purchase", purchase);
		builder.append("timingPurchase", timingPurchase);
		builder.append("person", person);
		builder.append("month", month);
		builder.append("subTime", subTime);
		return builder.toString();
	}

}
